﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SendMessage
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length != 2) {
                Console.WriteLine("Usage:\n\tSendMessage \"title\" \"pml commands\"");
            }
            else
            {
                string title = args[0];
                string command = args[1];
                MessageHelper msg = new MessageHelper();
                int hWnd = msg.getWindowId(null, title);
                if(hWnd == 0)
                {
                    Console.WriteLine(String.Format("Can't find window {0}",title));
                }
                else
                {
                    msg.sendWindowsStringMessage(hWnd, 0, command);
                }          
            }
        }
    }
}
